Optimal. Leaf size=74 \[ -\frac {a^2 x}{2}-\frac {2 a^2 \tanh ^{-1}(\cos (c+d x))}{d}+\frac {2 a^2 \cos (c+d x)}{d}-\frac {a^2 \cot (c+d x)}{d}+\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 74, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 6, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {2788, 3855,
3852, 8, 2718, 2715} \begin {gather*} \frac {2 a^2 \cos (c+d x)}{d}-\frac {a^2 \cot (c+d x)}{d}+\frac {a^2 \sin (c+d x) \cos (c+d x)}{2 d}-\frac {2 a^2 \tanh ^{-1}(\cos (c+d x))}{d}-\frac {a^2 x}{2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2715
Rule 2718
Rule 2788
Rule 3852
Rule 3855
Rubi steps
\begin {align*} \int \cot ^2(c+d x) (a+a \sin (c+d x))^2 \, dx &=\frac {\int \left (2 a^4 \csc (c+d x)+a^4 \csc ^2(c+d x)-2 a^4 \sin (c+d x)-a^4 \sin ^2(c+d x)\right ) \, dx}{a^2}\\ &=a^2 \int \csc ^2(c+d x) \, dx-a^2 \int \sin ^2(c+d x) \, dx+\left (2 a^2\right ) \int \csc (c+d x) \, dx-\left (2 a^2\right ) \int \sin (c+d x) \, dx\\ &=-\frac {2 a^2 \tanh ^{-1}(\cos (c+d x))}{d}+\frac {2 a^2 \cos (c+d x)}{d}+\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}-\frac {1}{2} a^2 \int 1 \, dx-\frac {a^2 \text {Subst}(\int 1 \, dx,x,\cot (c+d x))}{d}\\ &=-\frac {a^2 x}{2}-\frac {2 a^2 \tanh ^{-1}(\cos (c+d x))}{d}+\frac {2 a^2 \cos (c+d x)}{d}-\frac {a^2 \cot (c+d x)}{d}+\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.42, size = 94, normalized size = 1.27 \begin {gather*} -\frac {a^2 \csc \left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {1}{2} (c+d x)\right ) \left (7 \cos (c+d x)+\cos (3 (c+d x))+4 \left (c+d x-4 \cos (c+d x)+4 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-4 \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )\right ) \sin (c+d x)\right )}{16 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.15, size = 80, normalized size = 1.08
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\cot \left (d x +c \right )-d x -c \right )+2 a^{2} \left (\cos \left (d x +c \right )+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )+a^{2} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(80\) |
default | \(\frac {a^{2} \left (-\cot \left (d x +c \right )-d x -c \right )+2 a^{2} \left (\cos \left (d x +c \right )+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )+a^{2} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(80\) |
risch | \(-\frac {a^{2} x}{2}-\frac {i a^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{8 d}+\frac {a^{2} {\mathrm e}^{i \left (d x +c \right )}}{d}+\frac {a^{2} {\mathrm e}^{-i \left (d x +c \right )}}{d}+\frac {i a^{2} {\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}-\frac {2 i a^{2}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}-\frac {2 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}+\frac {2 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}\) | \(138\) |
norman | \(\frac {-\frac {a^{2}}{2 d}+\frac {a^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}-\frac {a^{2} \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}+\frac {a^{2} \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}-\frac {a^{2} x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2}-a^{2} x \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {a^{2} x \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}-\frac {4 a^{2} \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {4 a^{2} \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\frac {2 a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}\) | \(200\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.48, size = 79, normalized size = 1.07 \begin {gather*} \frac {{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2} - 4 \, {\left (d x + c + \frac {1}{\tan \left (d x + c\right )}\right )} a^{2} + 4 \, a^{2} {\left (2 \, \cos \left (d x + c\right ) - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )}}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.40, size = 105, normalized size = 1.42 \begin {gather*} -\frac {a^{2} \cos \left (d x + c\right )^{3} + 2 \, a^{2} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 2 \, a^{2} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + a^{2} \cos \left (d x + c\right ) + {\left (a^{2} d x - 4 \, a^{2} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, d \sin \left (d x + c\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int \cos ^{2}{\left (c + d x \right )} \csc ^{2}{\left (c + d x \right )}\, dx + \int 2 \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )} \csc ^{2}{\left (c + d x \right )}\, dx + \int \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )} \csc ^{2}{\left (c + d x \right )}\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 143 vs.
\(2 (70) = 140\).
time = 0.46, size = 143, normalized size = 1.93 \begin {gather*} -\frac {{\left (d x + c\right )} a^{2} - 4 \, a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {4 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )} + \frac {2 \, {\left (a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 4 \, a^{2}\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.81, size = 201, normalized size = 2.72 \begin {gather*} \frac {2\,a^2\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}+\frac {-3\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+8\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+8\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-a^2}{d\,\left (2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}+\frac {a^2\,\mathrm {atan}\left (\frac {a^4}{4\,a^4+a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}-\frac {4\,a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{4\,a^4+a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________